package cn.ffcs.uec.common.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import cn.ffcs.uec.common.dao.UecManagerInfoDao;
import cn.ffcs.uec.common.model.UecManagerInfo;
import cn.ffcs.uom.common.constants.BaseUnitConstants;
import cn.ffcs.uom.common.dao.BaseDaoImpl;

@Repository("uecManagerInfoDao")
public class UecManagerInfoDaoImpl extends BaseDaoImpl implements UecManagerInfoDao {
	@Override
	public UecManagerInfo findUecOrgDeptByOrgDept(UecManagerInfo uecManagerInfo) {
		if (null != uecManagerInfo) {
			StringBuilder sb = new StringBuilder(
					" SELECT * FROM UEC_MANAGER_INFO T WHERE T.STATUS_CD = ? ");
			List<Object> params = new ArrayList<Object>();
			params.add(BaseUnitConstants.ENTT_STATE_ACTIVE);
			if (null != uecManagerInfo.getCode()) {
				sb.append(" AND T.code = ? ");
				params.add(uecManagerInfo.getCode());
			}
			List<UecManagerInfo> list = this.jdbcFindList(sb.toString(), params,
					UecManagerInfo.class);
			if (list.size() > 0 && list != null) {
				return list.get(0);
			}
		}
		return null;
	}
}
